﻿@model IEnumerable<RedSand.Site.Models.NewsInfo>
<div class="panel">
    <div class="panel-header">
        <span>News manager</span>
    </div>
    <div class="panel-content">
        <div class="panel-toolbar">
            <ul>
                <li>
                    @Ajax.ActionLink("Add", "create", null, AdminAjaxOptions.GetForm, new { @class = "btn-create" })
                </li>                
                <li>
                    @Ajax.ActionLink("Delete all selected", "delete", null, AdminAjaxOptions.DeleteRecords, new { @class = "btn-deletes" })
                </li>
            </ul>
        </div>        
        @if (Model == null)
        {
            <div class="message warning">Data Empty</div>
        }
        else
        {
            <table class="table-list">
                <thead>
                    <tr>
                        <th class="center width-35">
                            <input type="checkbox" />
                        </th>
                        <th>
                           Title
                        </th>
                        
                        <th class="center width-80">
                            Control
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td class="center">
                                <input type="checkbox" value="@item.NewsID" />
                            </td>
                            <td>
                                @Html.ActionLink(item.Title, "details", new { id = item.NewsID }, new { target = "_blank" })
                            </td>
                            
                            <td class="center">
                                @Ajax.ActionLink("Edit", "edit", new { id = item.NewsID }, AdminAjaxOptions.GetForm, new { @class = "btn-edit", title = "Edit" })
                                @Ajax.ActionLink("Delete", "delete", new { id = item.NewsID }, AdminAjaxOptions.DeleteRecord, new { @class = "btn-delete", title = "Delete" })
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
            <div class="pager-wrapper">
                @Ajax.Pager(10, (int)ViewBag.TotalRecord, 7, PagerMode.NextPrevNumeric, AdminAjaxOptions.Paging)
                <div class="pager-loading-panel">
                </div>
            </div>
        }
    </div>
</div>
